#ifndef _GEN_VIDEO_PDF_HPP_
#define _GEN_VIDEO_PDF_HPP_

#include "video.hpp"
#include "gen_figure_swf.hpp"

class video_pdf:public figure_pdf {
	video* vid;
public:
	
	// script: $1=output file $2=input file
	// FIXME! untested
	virtual string capture_image(){
		if(vid->icon!="") return vid->icon;
		string ofile(vid->name+"_capture.png");
		call_script("capture-movie", ofile+" "+vid->input_file);
		if(file_exist(ofile)) {
			vid->garbage.push_back(ofile);
			return ofile;
		};
		cerr << "Can not capture movie icon. Using default icon for " << vid->input_file << "\n";
		return get_imagepath("movie.png");
	}

	virtual double draw(void* draw_param){
		vid=dynamic_cast<video*>(it);
		vid->input_file=capture_image();
		if(vid->input_file=="") return 0.0;
		return figure_pdf::draw(draw_param);
	}

};


#endif
